Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: Use an array of strings in the ChainID definition #593

Closed

Conversation

wking
Copy link
Contributor

@wking wking commented Mar 8, 2017

There's no need to couple this to DiffIDs and layer application, since the implementation in identity/chainid.go is just operating on an array of strings. In the chainid.go implementation, those strings happen to be digests, but nothing digest-specific is needed.

$ cat a.go
package main

import (
  _ "crypto/sha256"
  "fmt"
  "github.com/opencontainers/go-digest"
  "github.com/opencontainers/image-spec/identity"
)

func main() {
  for _, chainID := range identity.ChainIDs([]digest.Digest{"a", "b", "c"}) {
    fmt.Println(chainID)
  }
}
$ go run a.go
a
sha256:c8687a08aa5d6ed2044328fa6a697ab8e96dc34291e8c2034ae8c38e6fcc6d65
sha256:fd4283a6ddaa46181b8c3bd3f2497dd8f801e80b395b78bd6331197ba8db877d

which matches the example I'm adding with this commit.

In #586, there were some claims that the ChainID was operating on the resulting filesystem and not on an array of digest strings (e.g. here and here). But that's clearly not how the chainid.go or currently-defined recursion algorithm works. In order to have a ChainID based on the resulting filesystem and support ChainID(C) = ChainID(∅|C), you'd need to define it recursively on the resulting filesystem instead of on the array stack. Something like:

ChainID(filesystemPath) = Digest(ChainID(directory1) + ChainID(directory2) + … + ChainID(file1) + ChainID(file2) + …)

But as I pointed out here, hashing a filesystem is a lot more complicated than hashing a byte-string.

Folks interested in using whatever DiffID implementation they like can easily recover the old coupled behavior by using:

ChainID([DiffID(L₀), …, DiffID(Lₙ)])

There's no need to couple this to DiffIDs and layer application, since
the implementation in identity/chainid.go is just operating on an
array of strings.  In the chainid.go implementation, those strings
happen to be digests, but nothing digest-specific is needed.

  $ cat a.go
  package main

  import (
    _ "crypto/sha256"
    "fmt"
    "github.com/opencontainers/go-digest"
    "github.com/opencontainers/image-spec/identity"
  )

  func main() {
    for _, chainID := range identity.ChainIDs([]digest.Digest{"a", "b", "c"}) {
      fmt.Println(chainID)
    }
  }
  $ go run a.go
  a
  sha256:c8687a08aa5d6ed2044328fa6a697ab8e96dc34291e8c2034ae8c38e6fcc6d65
  sha256:fd4283a6ddaa46181b8c3bd3f2497dd8f801e80b395b78bd6331197ba8db877d

which matches the example I'm adding with this commit.

Signed-off-by: W. Trevor King <wking@tremily.us>
@stevvooe
Copy link
Contributor

stevvooe commented Mar 8, 2017

There's no need to couple this to DiffIDs and layer application, since the implementation in identity/chainid.go is just operating on an array of strings.

And, as I have tried to make you understand, this premise is completely false.

The algorithm described in this section is expressed in terms of abstract layers, not strings. These changes, subsequently, are incorrect, in that it inappropriately narrows the definition. The representation of the filesystem changeset is not important for this definition.

If you had listened to my response in #586, you would have already understood this.

If you would like to describe the implementation, you are welcome to put the information up on a blog, but for the specification, this is sufficient.

@stevvooe stevvooe closed this Mar 8, 2017
@wking
Copy link
Contributor Author

wking commented Mar 8, 2017 via email

@stevvooe
Copy link
Contributor

stevvooe commented Mar 8, 2017

We can look at this as [DiffID(L₀), …, DiffID(Lₙ)] != L₀|…Lₙ is not always the case. While we may represent that application with the array, it is not necessary to calculate this from the point of the array. In fact, the expansion of DiffID(Lₙ) is part of the definition of the ChainID, allowing us to abstract the algorithm in the definitions of the function Digest and DiffID. Your definition requires the user of this algorithm to create an array, which may not exist while the current definition allows that calculation to be made on demand.

If you want to make a clear argument for my definition here being
false, please provide a ChainID invocation and results which are not
covered by my definition here.

This argument has been made in #586, the implementation of ChainID in image-spec, the demonstration of ChainID in containerd, the production implementation and usage of ChainID in docker and the several years of experience put into the review of this information by multiple members of our team before I posted it in the #482. We did not just pull this out of thin air.

At this point, your position has not changed, bordering on blatant intellectual dishonesty. I have wasted hours pushing through what should have been a very simple clarification trying to explain these details to you and you continue to badger me about it. In my view, all of this is time and energy that could have been put towards a working 1.0 specification. While it is unfair to me, it is incredibly unfair to the community to be dragging the conversation down your selfish path when we should be stabilizing and implementing.

@wking
Copy link
Contributor Author

wking commented Mar 8, 2017 via email

@stevvooe
Copy link
Contributor

stevvooe commented Mar 8, 2017

@wking You have now been blocked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants